package com.nengchuan.eic.nceconomy.entity.vo;

import com.nengchuan.eic.nceconomy.annotation.ExcelColumn;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * 功能描述:
 *
 * @Author: liurui
 * @Date: 2020/5/8 0008 下午 4:11
 */
@Data
public class VerifyResultVO {
    @ApiModelProperty(value = "是否通过")
    private Boolean isPass;
    @ApiModelProperty(value = "文件名")
    private String excelName;
    @ApiModelProperty(value = "sheet验证结果")
    private List<Result> sheetResult;

    @ApiModelProperty(value = "内容和项目不匹配数量")
    private Long contentDiffNum;

    @Data
    @AllArgsConstructor
    public static class Result {
        @ApiModelProperty(value = "校验结果id")
        private Long id;

        @ApiModelProperty(value = "模板名")
        private String templateName;

        @ApiModelProperty(value = "excel名")
        private String excelName;

        @ApiModelProperty(value = "状态 1-通过 2-警告 3-拦截")
        private Integer status;
    }

    @Data
    @AllArgsConstructor
    public static class ContentResult {
        @ApiModelProperty(value = "校验结果id")
        private Long id;

        @ApiModelProperty(value = "模板sheet名")
        private String templateName;

        @ApiModelProperty(value = "excel名")
        private String excelName;

        @ApiModelProperty(value = "模板序号")
        private String templateSerialNum;

        @ApiModelProperty(value = "模板名称")
        private String templateVal;

        @ApiModelProperty(value = "excel序号")
        private String excelSerialNum;

        @ApiModelProperty(value = "excel名称")
        private String excelVal;

        @ApiModelProperty(value = "状态 1-通过 2-警告 3-拦截")
        private Integer status;

        @ApiModelProperty(value = "错误描述")
        private String errorMsg;

    }

    @Data
    public static class ContentResultExcel {

        @ApiModelProperty(value = "模板sheet名")
        private String templateName;

        @ExcelColumn(value = "excel名", col = 1)
        @ApiModelProperty(value = "excel名")
        private String excelName;

        @ExcelColumn(value = "模板序号", col = 2)
        @ApiModelProperty(value = "模板序号")
        private String templateSerialNum;

        @ExcelColumn(value = "模板名称", col = 3)
        @ApiModelProperty(value = "模板名称")
        private String templateVal;

        @ExcelColumn(value = "excel序号", col = 4)
        @ApiModelProperty(value = "excel序号")
        private String excelSerialNum;

        @ExcelColumn(value = "excel名称", col = 5)
        @ApiModelProperty(value = "excel名称")
        private String excelVal;

        @ExcelColumn(value = "状态", col = 6)
        @ApiModelProperty(value = "状态 1-通过 2-警告 3-拦截")
        private String status;

        @ExcelColumn(value = "错误描述", col = 7)
        @ApiModelProperty(value = "错误描述")
        private String errorMsg;

        @ExcelColumn(value = "确认状态", col = 8)
        @ApiModelProperty(value = "是否确认")
        private String commitFlag;

        public ContentResultExcel(ContentResult result){
            this.templateName=result.getTemplateName();
            this.excelName=result.getExcelName();
            this.templateSerialNum=result.getTemplateSerialNum();
            this.templateVal=result.getTemplateVal();
            this.excelSerialNum=result.getExcelSerialNum();
            this.excelVal=result.getExcelVal();
            if(result.getStatus()==2){
                this.setStatus("警告");
                this.commitFlag="未确认";
            }else{
                this.commitFlag="已确认";
                this.setStatus("通过");
            }
            this.errorMsg=result.getErrorMsg();
        }

    }

}
